package cn.gx.kevin.domain;

import org.apache.commons.collections4.map.LinkedMap;

import java.util.Map;

/***
 *@description :  单条数据插入参数
 *@author : kevin.huang
 *@date : 2019/10/26 15:49
 @modified by
 ***/
public class DynamicInsertParam extends DynamicBaseParam{

    /*****插入的字段-值*****/
    LinkedMap<String,DynamicInsertFieldValue> fields;

    /*****插入的字段-值*****/
    public LinkedMap<String, DynamicInsertFieldValue> getFields() {
        return fields;
    }

    /*****插入的字段-值*****/
    public void setFields(LinkedMap<String, DynamicInsertFieldValue> fields) {
        for(Map.Entry<String,DynamicInsertFieldValue> entry : fields.entrySet()){
            DynamicInsertFieldValue pr = entry.getValue();
            Object value =  pr.getFieldValue();
            if(value instanceof  String){
                pr.setFieldValue(this.replaceIllegalChars(String.valueOf(value)));
            }
        }
        this.fields = fields;
    }

}
